﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TA.DotNetUtils;

namespace TA.Turbo
{
	/// <summary>
	/// Collection of script or style includes.
	/// </summary>
	public class IncludeCollection : Dictionary<string, BaseInclude>
	{
		public void Add(BaseInclude include)
		{
			if (!this.ContainsKey(include.FileName))
			{
				this.Add(include.FileName, include);
			}
		}
		/// <summary>
		/// Adds an script include to the collection.
		/// </summary>
		/// <param name="script">The script to be added.</param>
		public void Add(Script script)
		{
			this.Add(Script.General.GetInclude());

			foreach (Script dependency in script.GetDependencies())
				this.Add(dependency);

			this.Add(script.GetInclude());
		}
	}
}
